package com.woniu.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.woniu.entity.Auction;
import com.woniu.utils.MyPage;
import com.woniu.vo.QueryVo;
import com.github.pagehelper.PageHelper;
import com.woniu.dao.AuctionMapper;

@Transactional
@Service
public class AuctionService {
	@Autowired
	private AuctionMapper auctionMapper;

	public AuctionMapper geauctionMapper() {
		return auctionMapper;
	}
	
	//--分页查询
			public MyPage<QueryVo> selectByPage(int pageNum,int pageSize,String goodstatus) {
				// --查询
				int count = auctionMapper.findCount(goodstatus);
				PageHelper.startPage(pageNum,pageSize);
				List<QueryVo> list = auctionMapper.selectAuction(goodstatus);
				MyPage<QueryVo> page = new MyPage<QueryVo>(count, pageSize, list);
				System.out.println(auctionMapper.selectAuction(goodstatus));
				return page;
				
			}
			//--根据ID查询竞拍信息
			public QueryVo selectAuctionById(Integer aid) {
				
				return auctionMapper.findAuctionById(aid);
			}

			public void updateStatusById(Integer aid,String userstatus) {
				auctionMapper.updateBuyerStatusById(aid,userstatus);
			}
			
			public QueryVo selectBuyerInfoById(Integer aid) {
				
				return auctionMapper.findBuyerInfoById(aid);
			}
			public QueryVo selectRecordById(Integer aid) {
				return auctionMapper.findRecordById(aid);
			}

}